package com.glsc.ngateway.platform.service.itflow.flowstrategy.cmdb.deviceStandardModify.taskPostHandler;

import com.glsc.ngateway.common.api.flowable.dto.task.doTaskParam.cmdb.CMDBPassParamDto;
import com.glsc.ngateway.common.api.flowable.dto.task.formData.cmdb.DeviceStandardModifyTaskFormDto;
import com.glsc.ngateway.common.api.flowable.dto.task.formData.cmdb.domainDto.FlowFormDeviceStandardModifyDto;
import com.glsc.ngateway.common.base.enums.itflow.ITFlowTaskEnum;
import com.glsc.ngateway.platform.service.itflow.flowstrategy.cmdb.deviceStandardModify.DeviceStandardModifyFlowStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.validation.constraints.NotNull;

/**
 * @author liwei
 * @date 2023/8/2-16:16
 */
@Component
public class DPSMStep1BeginTaskPostHandlerAudit implements IDeviceStandardModifyTaskPostHandlerAudit {

    @Autowired
    DeviceStandardModifyFlowStrategy deviceStandardModifyFlowStrategy;

    @Override
    public String getTaskDefinitionKey() {
        return ITFlowTaskEnum.CMDB_DEVICE_STANDARD_MODIFY_FLOW_BEGIN_TASK.getTaskKey();
    }
    @Override
    //重写方法权限升级为public，里氏代换原则--任何基类可以出现的地方，子类一定可以出现
    public void passAfterHandle(@NotNull CMDBPassParamDto<FlowFormDeviceStandardModifyDto, DeviceStandardModifyTaskFormDto> passParam, @NotNull String operator) throws Exception {
        deviceStandardModifyFlowStrategy.saveOrUpdateForm(passParam.getFlowableFormData(),operator);
    }

}
